import { reactive } from "vue";
import type { FormRules } from "element-plus";

/** 手机号正则 */
export const REGEXP_PHONE = /^1[1-9]\d{9}$/;

/** 登录校验 */
const loginRules = reactive<FormRules>({
  contact_phone: [
    {
      required: true,
      message: "请输入手机号",
      trigger: "blur"
    },
    {
      pattern: REGEXP_PHONE,
      message: "请输入正确的手机号格式",
      trigger: "blur"
    }
  ],
  password: [
    {
      required: true,
      message: "请输入密码",
      trigger: "blur"
    }
  ],
  captcha: [
    {
      required: true,
      message: "请输入图形验证码",
      trigger: "blur"
    }
  ],
  verifyCode: [
    {
      required: true,
      message: "请输入验证码",
      trigger: "blur"
    }
  ]
});

export { loginRules };
